package io.renren.modules.echarts.controller;


import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.common.utils.R;
import io.renren.modules.echarts.entity.EchartsDate;
import io.renren.modules.echarts.entity.TeacherEvaltionPieEntity;
import io.renren.modules.echarts.service.TeacherEvaluationChartsService;
import io.renren.modules.jxgk.entity.TeacherCourseContentEntity;
import io.renren.modules.jxgk.entity.TeacherEvaluationSumEntity;
import io.renren.modules.jxgk.service.TeacherEvaluationSumService;
import io.renren.modules.sys.entity.SysUserEntity;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/TeacherEvaluationCharts")
public class TeacherEvaluationChartsController {


    @Autowired
    TeacherEvaluationSumService teacherEvaluationSumService;
    @Autowired
    TeacherEvaluationChartsService teacherEvaluationChartsService;
    @RequestMapping("Select")
    public R list(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        List<TeacherEvaluationSumEntity> cse = teacherEvaluationSumService.queryList(query);
        int total = teacherEvaluationSumService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(cse, total, query.getLimit(), query.getPage());

        return R.ok().put("page", pageUtil);
    }


    @RequestMapping("/getAverageTeacheingTimeRanking")
    public R getAverageTeacheingTimeRanking(@RequestParam Map<String, Object> params) {
        Map<String,Object> rank =teacherEvaluationChartsService.getAverageTeacheingTimeRanking(params);
        return R.ok().put("option",rank);
    }

    @RequestMapping("/getCollegeTeacheingRanking")
    public R getCollegeTeacheingRanking(@RequestParam Map<String, Object> params) {
        Map<String,Object> rank =teacherEvaluationChartsService.getCollegeTeacheingRanking(params);
        return R.ok().put("option",rank);
    }

    @RequestMapping("/getTeacherWorkTimeRate")
    public R getTeacherWorkTimeRate(@RequestParam Map<String, Object> params) {
        Map<String,Object> rank =teacherEvaluationChartsService.getTeacherWorkTimeRate(params);
        return R.ok().put("option",rank);
    }

    @RequestMapping("/getTeacherWorkEcharts")
    public R getTeacherWorkEcharts(@RequestParam Map<String, Object> params) {
        List rank =teacherEvaluationChartsService.getTeacherWorkEcharts(params);
        return R.ok().put("option",rank);
    }
}


